//
//  Function.m
//  Day11homework
//
//  Created by dllo on 16/5/18.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "Function.h"

//修改为0
BOOL setSum (int sum){
    return sum % 3 == 0 ? YES : NO;
}
//随机生成十个元素的数组,并找到三的倍数

void creatNum(int a[], int count , CHANGE p) {
    
    for (int i = 0; i < count; i++) {
        a[i] = arc4random() % 100 + 1;
        printf("%d,",a[i]);
        if(p(a[i])){
            a[i] = 0;
        }
    }
    printf("\n");
    for (int j = 0; j < 10; j++){
        printf("%d,",a[j]);
    }
}
//比较两个数
BOOL compare (int a ,int b) {
    return  a > b ? YES : NO;
}
//交换两个数
void changeTwo (int *a ,int *b) {
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
}

//带入数组的比较
void takeArray (int a[] ,int b[] ,FUNC p, ChangeTwo q) {
    for (int i = 0;i < 10;i++) {
        if(p(a[i],b[i])){
            q(&a[i],&b[i]);
        }
    }
}



